import torch
from torch import nn
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision.transforms import ToTensor

print(torch)

# Download training data from open datasets.
training_data = datasets.FashionMNIST( # 训练集
    root="data",
    train=True,
    download=True,
    transform=ToTensor(),
) # FashionMNIST：一个包含10类时尚物品（如T恤、裤子、运动鞋等）的灰度图像数据集，每张图片大小为28x28像素，共60,000张训练图片和10,000张测试图片。

# Download test data from open datasets.
test_data = datasets.FashionMNIST( # 测试集
    root="data",
    train=False,
    download=True,
    transform=ToTensor(),
)

batch_size = 64

# Create data loaders.
train_dataloader = DataLoader(training_data, batch_size=batch_size)
test_dataloader = DataLoader(test_data, batch_size=batch_size)

for X, y in test_dataloader:
    print(f"Shape of X [N, C, H, W]: {X.shape}")
    print(f"Shape of y: {y.shape} {y.dtype}")
    break